package de.koller.worlders.engine.entity.deco;

import de.koller.worlders.WorldersRoot;
import de.koller.worlders.engine.tiles.ITile;
import de.koller.worlders.engine.tiles.data.ITileCreator;
import de.koller.worlders.render.VisualMap;
import de.koller.worlders.render.visual.DisplayRenderObject;

public class RollBall extends Deco {
	public static final int GEN_ID = 6;
	
	public static final ITileCreator GEN_INSTANCE = new ITileCreator() {
		@Override public ITile newInstance() {
			return new RollBall();
		}
		
		@Override public DisplayRenderObject getIcon() { return VisualMap.rollBall; }
		@Override public String getName() { return "Kugel"; }
	};

	public RollBall() {
		super( 0.6f );
		//this.setDecoEntity( new Plattform().addEffect( new RollBallPlattform() ) );
	}

	@Override
	public void generate( WorldersRoot root, Object... references ) {
		super.generate( root, references );
		
		this.setVisual( VisualMap.rollBall );
		
		int tx = tile.getPosition().getXi();
		int ty = tile.getPosition().getYi();
		tile.root.getTileMap().tileHolder.changeMapData( tx, ty, -1, -1, 0, -1 );
		tile.root.getTileMap().reloadTile( tx, ty );
		
		if( tile.root == null )
			return;
		
		tile.root.getEntityContainer().addChild( new RollBallMO( tx, ty ) );
	}

}
